/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.model;

import com.hotel.test.service.BookingLocalServiceUtil;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.DateUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.util.PortalUtil;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.Date;

/**
 * @author Vien-IT
 */
public class BookingClp extends BaseModelImpl<Booking> implements Booking {
	public BookingClp() {
	}

	public Class<?> getModelClass() {
		return Booking.class;
	}

	public String getModelClassName() {
		return Booking.class.getName();
	}

	public long getPrimaryKey() {
		return _bookId;
	}

	public void setPrimaryKey(long primaryKey) {
		setBookId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_bookId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public long getBookId() {
		return _bookId;
	}

	public void setBookId(long bookId) {
		_bookId = bookId;
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public String getUserName() {
		return _userName;
	}

	public void setUserName(String userName) {
		_userName = userName;
	}

	public Date getCreateDate() {
		return _createDate;
	}

	public void setCreateDate(Date createDate) {
		_createDate = createDate;
	}

	public Date getModifiedDate() {
		return _modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		_modifiedDate = modifiedDate;
	}

	public String getNamePersonBooking() {
		return _namePersonBooking;
	}

	public void setNamePersonBooking(String namePersonBooking) {
		_namePersonBooking = namePersonBooking;
	}

	public String getNumberPhone() {
		return _numberPhone;
	}

	public void setNumberPhone(String numberPhone) {
		_numberPhone = numberPhone;
	}

	public String getEmailBooking() {
		return _emailBooking;
	}

	public void setEmailBooking(String emailBooking) {
		_emailBooking = emailBooking;
	}

	public String getAddress() {
		return _address;
	}

	public void setAddress(String address) {
		_address = address;
	}

	public int getNumberOfGuest() {
		return _numberOfGuest;
	}

	public void setNumberOfGuest(int numberOfGuest) {
		_numberOfGuest = numberOfGuest;
	}

	public String getOtherRequest() {
		return _otherRequest;
	}

	public void setOtherRequest(String otherRequest) {
		_otherRequest = otherRequest;
	}

	public String getDayStart() {
		return _dayStart;
	}

	public void setDayStart(String dayStart) {
		_dayStart = dayStart;
	}

	public String getDayFinish() {
		return _dayFinish;
	}

	public void setDayFinish(String dayFinish) {
		_dayFinish = dayFinish;
	}

	public long getHotelId() {
		return _hotelId;
	}

	public void setHotelId(long hotelId) {
		_hotelId = hotelId;
	}

	public long getRomId() {
		return _romId;
	}

	public void setRomId(long romId) {
		_romId = romId;
	}

	public void persist() throws SystemException {
		if (this.isNew()) {
			BookingLocalServiceUtil.addBooking(this);
		}
		else {
			BookingLocalServiceUtil.updateBooking(this);
		}
	}

	@Override
	public Booking toEscapedModel() {
		return (Booking)Proxy.newProxyInstance(Booking.class.getClassLoader(),
			new Class[] { Booking.class }, new AutoEscapeBeanHandler(this));
	}

	@Override
	public Object clone() {
		BookingClp clone = new BookingClp();

		clone.setBookId(getBookId());
		clone.setUserId(getUserId());
		clone.setUserName(getUserName());
		clone.setCreateDate(getCreateDate());
		clone.setModifiedDate(getModifiedDate());
		clone.setNamePersonBooking(getNamePersonBooking());
		clone.setNumberPhone(getNumberPhone());
		clone.setEmailBooking(getEmailBooking());
		clone.setAddress(getAddress());
		clone.setNumberOfGuest(getNumberOfGuest());
		clone.setOtherRequest(getOtherRequest());
		clone.setDayStart(getDayStart());
		clone.setDayFinish(getDayFinish());
		clone.setHotelId(getHotelId());
		clone.setRomId(getRomId());

		return clone;
	}

	public int compareTo(Booking booking) {
		int value = 0;

		value = DateUtil.compareTo(getModifiedDate(), booking.getModifiedDate());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		BookingClp booking = null;

		try {
			booking = (BookingClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = booking.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(31);

		sb.append("{bookId=");
		sb.append(getBookId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", userName=");
		sb.append(getUserName());
		sb.append(", createDate=");
		sb.append(getCreateDate());
		sb.append(", modifiedDate=");
		sb.append(getModifiedDate());
		sb.append(", namePersonBooking=");
		sb.append(getNamePersonBooking());
		sb.append(", numberPhone=");
		sb.append(getNumberPhone());
		sb.append(", emailBooking=");
		sb.append(getEmailBooking());
		sb.append(", address=");
		sb.append(getAddress());
		sb.append(", numberOfGuest=");
		sb.append(getNumberOfGuest());
		sb.append(", otherRequest=");
		sb.append(getOtherRequest());
		sb.append(", dayStart=");
		sb.append(getDayStart());
		sb.append(", dayFinish=");
		sb.append(getDayFinish());
		sb.append(", hotelId=");
		sb.append(getHotelId());
		sb.append(", romId=");
		sb.append(getRomId());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(49);

		sb.append("<model><model-name>");
		sb.append("com.hotel.test.model.Booking");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>bookId</column-name><column-value><![CDATA[");
		sb.append(getBookId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userName</column-name><column-value><![CDATA[");
		sb.append(getUserName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>createDate</column-name><column-value><![CDATA[");
		sb.append(getCreateDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
		sb.append(getModifiedDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>namePersonBooking</column-name><column-value><![CDATA[");
		sb.append(getNamePersonBooking());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberPhone</column-name><column-value><![CDATA[");
		sb.append(getNumberPhone());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>emailBooking</column-name><column-value><![CDATA[");
		sb.append(getEmailBooking());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>address</column-name><column-value><![CDATA[");
		sb.append(getAddress());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberOfGuest</column-name><column-value><![CDATA[");
		sb.append(getNumberOfGuest());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>otherRequest</column-name><column-value><![CDATA[");
		sb.append(getOtherRequest());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dayStart</column-name><column-value><![CDATA[");
		sb.append(getDayStart());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>dayFinish</column-name><column-value><![CDATA[");
		sb.append(getDayFinish());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>hotelId</column-name><column-value><![CDATA[");
		sb.append(getHotelId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>romId</column-name><column-value><![CDATA[");
		sb.append(getRomId());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _bookId;
	private long _userId;
	private String _userUuid;
	private String _userName;
	private Date _createDate;
	private Date _modifiedDate;
	private String _namePersonBooking;
	private String _numberPhone;
	private String _emailBooking;
	private String _address;
	private int _numberOfGuest;
	private String _otherRequest;
	private String _dayStart;
	private String _dayFinish;
	private long _hotelId;
	private long _romId;
}